#!/usr/bin/env python

import gammu
import threading
import Queue
from Sms import *
from SmsSender import *
from SmsReciver import *

class SmsModem: #(object): #implements SmsModuleInterface:
    def __init__(self):
	self._reciveQueue = Queue.Queue(0)
	self._sendQueue = Queue.Queue(0)
	self._stateMachine = gammu.StateMachine()
	self._stateMachine.ReadConfig()
	self._stateMachine.Init()
	#SmsSender(stateMachine, self._sendQueue).start()
	#SmsReciver(stateMachine, self._reciveQueue).start()
	smsSender = SmsSender(self._stateMachine, self._sendQueue)
	smsReciver = SmsReciver(self._stateMachine, self._reciveQueue)
	smsSender.start()
	smsReciver.start()

    def putSmsOnSendQueue(self, sms):
	""" puts sms on queue without blocking """
	self._sendQueue.put_nowait(sms)
    def getSmsFromReciveQueue(self):
	""" gets sms from queue without blocking """
	return self._reciveQueue.get_nowait()

def main():
	smsModem = SmsModem();

if __name__=="__main__":
	main()
